import React from 'react'
import { User } from '../Search/Search'

interface Project {
  name: string
  userId: number | string
}

interface TableListProps {
  user: User[]
  project: Project[]
}
export const TableList = ({ user, project }: TableListProps) => {
  return (
    <>
      <table>
        <thead>
          <tr>
            <th>名称</th>
            <th>负责人</th>
          </tr>
        </thead>
        <tbody>
          {project.map(item => {
            return (
              <tr key={item.name}>
                <td>{item.name}</td>
                <td>{user.find(u => u.userId === item.userId)?.name || '未知'}</td>
              </tr>
            )
          })}
        </tbody>
      </table>
    </>
  )
}
